package com.matrix.tool.ui.tool.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.matrix.basecore.utils.glide.GlideUtil
import com.matrix.tool.R
import com.matrix.tool.bean.BaseMultiQuickItem
import com.matrix.tool.bean.PhotoPathInfo

class PhotoAdapter(dates: MutableList<PhotoPathInfo>) :
    BaseMultiItemQuickAdapter<PhotoPathInfo, BaseViewHolder>(dates), LoadMoreModule {

    init {
        addItemType(BaseMultiQuickItem.FIRST_TYPE, R.layout.git_photo_empty_item)
        addItemType(BaseMultiQuickItem.SECOND_TYPE, R.layout.git_photo_item)
        addChildClickViewIds(R.id.rl_add, R.id.iv_image, R.id.iv_delete)
    }

    override fun convert(holder: BaseViewHolder, item: PhotoPathInfo) {
        when (holder.itemViewType) {
            BaseMultiQuickItem.FIRST_TYPE -> {

            }

            BaseMultiQuickItem.SECOND_TYPE -> {
                GlideUtil.loadRoundImage(
                    item.path, context, holder.getView(R.id.iv_image), 8,
                    com.matrix.basecore.R.mipmap.icon_default_bg
                )
            }
        }
    }
}